<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <!-- 避免IE使用兼容模式 -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
    <meta name="renderer" content="webkit">
    <!-- TopJUI框架样式 -->
    <link type="text/css" href="../../topjui/themes/default/topjui.core.min.css" rel="stylesheet">
    <link type="text/css" href="../../topjui/themes/default/topjui.blue.css" rel="stylesheet" id="dynamicTheme"/>
    <!-- FontAwesome字体图标 -->
    <link type="text/css" href="../../static/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet"/>
    <!-- layui框架样式 -->
    <link type="text/css" href="../../static/plugins/layui/css/layui.css" rel="stylesheet"/>
    <!-- jQuery相关引用 -->
    <script type="text/javascript" src="../../static/plugins/jquery/jquery.min.js"></script>
    <script type="text/javascript" src="../../static/plugins/jquery/jquery.cookie.js"></script>
    <!-- TopJUI框架配置 -->
    <script type="text/javascript" src="../../static/public/js/topjui.config.js"></script>
    <!-- TopJUI框架核心-->
    <script type="text/javascript" src="../../topjui/js/topjui.core.min.js"></script>
    <!-- TopJUI中文支持 -->
    <script type="text/javascript" src="../../topjui/js/locale/topjui.lang.zh_CN.js"></script>
    <!-- layui框架js -->
    <script type="text/javascript" src="../../static/plugins/layui/layui.js" charset="utf-8"></script>
</head>

<body>
<div style="margin-left:10px">
<div style="margin:20px 0;">
    <a href="javascript:void(0)" data-toggle="topjui-linkbutton" onclick="showGroup()">展示分组</a>
    <a href="javascript:void(0)" data-toggle="topjui-linkbutton" data-options="btnCls: 'topjui-btn-red'"onclick="hideGroup()">隐藏分组</a>
    <a href="javascript:void(0)" data-toggle="topjui-linkbutton" data-options="btnCls: 'topjui-btn-brown'"onclick="showHeader()">展示头部</a>
    <a href="javascript:void(0)" data-toggle="topjui-linkbutton" data-options="btnCls: 'topjui-btn-black'"onclick="hideHeader()">隐藏头部</a>
    <a href="javascript:void(0)" data-toggle="topjui-linkbutton" data-options="btnCls: 'topjui-btn-blue'"onclick="getChanges()">获取变化值</a>
</div>
<table id="pg" data-toggle="topjui-propertygrid" style="width:300px" data-options="
                url:'../../json/propertygrid/propertygrid_data1.json',
                method:'get',
                showGroup:true,
                scrollbarSize:0
            ">
</table>
</div>
<script type="text/javascript">
    function showGroup(){
        $('#pg').iPropertygrid({
            showGroup:true
        });
    }
    function hideGroup(){
        $('#pg').iPropertygrid({
            showGroup:false
        });
    }
    function showHeader(){
        $('#pg').iPropertygrid({
            showHeader:true
        });
    }
    function hideHeader(){
        $('#pg').iPropertygrid({
            showHeader:false
        });
    }
    function getChanges(){
        var s = '';
        var rows = $('#pg').iPropertygrid('getChanges');
        for(var i=0; i<rows.length; i++){
            s += rows[i].name + ':' + rows[i].value + ',';
        }
        alert(s)
    }
</script>
</body>
</html>